'use strict';
//提现 记录表
module.exports = {
  up: async (queryInterface, Sequelize) => {
    const { INTEGER, STRING, DATE, ENUM } = Sequelize;
    // 创建表
    await queryInterface.createTable('cashout', {
      id: {
        type: INTEGER(30).UNSIGNED,
        primaryKey: true,
        autoIncrement: true
      },
      type: {
        type: ENUM,
        values: ['shop', 'wxuser'],
        allowNull: false,
        defaultValue: 'shop',
        comment: '类型 shop商家  wxuser代理 '
      },
      type_id: {
        type: INTEGER(30),
        allowNull: false,
        defaultValue: 0,
        comment: '商家 代理 id'
      },
      content: {
        type: STRING(2000),
        allowNull: false,
        defaultValue: '0',
        comment: '内容',
      },
      price: {
        type: STRING(200),
        allowNull: false,
        defaultValue: '',
        comment: '交易金额',
      },
      fail_centent: {
        type: STRING(400),
        comment: '失败原因',
      },
      status: {
        type: ENUM,
        values: ['success', 'fail','wait'],
        allowNull: false,
        defaultValue: 'wait',
        comment: '状态 success成功  fail失败  wait等待',
      },
      created_at: DATE,
      updated_at: DATE,
    });
  },
  down: async (queryInterface, Sequelize) => {
    await queryInterface.dropTable('cashout');
  }
};
